package main

func lengthOfLIS(nums []int) int {
	if len(nums) < 2 {
		return len(nums)
	}
	table := make([]int, len(nums))
	table[0] = 1
	result := 0
	for i := 1; i < len(nums); i++ {
		max := 0
		for j := 0; j < i; j++ {
			if nums[j] < nums[i] && table[j] > max {
				max = table[j]
			}
		}
		table[i] = max + 1
		if table[i] > result {
			result = table[i]
		}
	}
	return result
}

func main() {
	println(lengthOfLIS([]int{10, 9, 2, 5, 3, 7, 101, 18}))
}
